#include "calculator_service_impl.h"

CalculatorServiceImpl::CalculatorServiceImpl()
{

}

grpc::Status CalculatorServiceImpl::Add(grpc::ServerContext *context,
                                        const test::Params *request,
                                        test::Result *response) {
    response->set_result(request->a() + request->b());
    return Status::OK;
}

grpc::Status CalculatorServiceImpl::Subtract(grpc::ServerContext *context,
                                             const test::Params *request,
                                             test::Result *response) {
    response->set_result(request->a() - request->b());
    return Status::OK;
}

grpc::Status CalculatorServiceImpl::Multiply(grpc::ServerContext *context,
                                             const test::Params *request,
                                             test::Result *response) {
    response->set_result(request->a() * request->b());
    return Status::OK;
}

grpc::Status CalculatorServiceImpl::Divide(grpc::ServerContext *context,
                                           const test::Params *request,
                                           test::Result *response) {
    response->set_result(request->a() / request->b());
    return Status::OK;
}
